{include file="public/header" /}
{load href="__PLUGINS__bootstrap/bootstrap-table.min.css"}
{load href="__PLUGINS__bootstrap/bootstrap-table.min.js"}
<style>
    #des, #des input {
        width: 40px;
        text-align: center;
    }

    #id {
        width: 78px;
    }

    .bs-checkbox {
        width: 36px;
        height: 40px
    }

    .fixed-table-toolbar .columns, .fixed-table-toolbar .search {
        margin-left: 0;
        margin-top: 0
    }

    #title span {
        float: right;
    }

    .asdlkjasd {
        background: #1ab394;
        color: #fff;
    }

    .ibox-content {
        clear: both;
        overflow-x: auto;
    }
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">

        <div class="wrapper wrapper-content {:config('adminClass.main')}">
            <div class="ibox float-e-margins">
                <div class="">
                    <a onclick="add('{:url(\'addNext\',[\'url\'=>-1])}')" href="javascript:void(0);" class="btn btn-primary ">添加下级</a>
                </div>
                <script type="text/javascript">
                    function add(url){
                        layer.open({
                            type: 2,
                            title: '提示',
                            shadeClose: false,
                            shade: 0.2,
                            area: ['90%', '90%'],
                            skin:'shangchuantup',
                            shift:-1,
                            content: url,
                            scrollbar: false,
                            moveType: 1,
                            moveOut: true
                        });
                    }
                </script>
                <div class="ibox-content">
                <div class="ibox-content">
                    {include file="public/topsection"}
                    <div class="row row-lg">
                        <div class="col-sm-12">
                            <div class="fixed-table-toolbar" style="text-align: center;margin-bottom: 20px">
                                <h2>总人数: <span style="color: #1ab394; ">{$sum}</span> </h2>
                            </div>
                            <div class="fixed-table-toolbar">
                                <form  method="get" action="" style="display: flex;">
                                    <div class="pull-left search" style="display: flex;">
                                        <div class="columns columns-right btn-group pull-left">
                                            <select class="form-control" name="type">
                                                <option value="name" {php}if(input('?param.type')){if(input('param.type')=='name'){echo "selected";} }{/php}>账号</option>
                                            </select>
                                        </div>

                                        <div class="pull-right search">
                                            <input class="form-control input-outline" type="text"
                                                   {php}
                                                   if(input('?param.name')){
                                            if(input('param.name')){
                                            echo "value='".input('name')."'";
                                            }

                                            }
                                            {/php}
                                            name="name" placeholder="搜索">
                                        </div>

                                        <div class="pull-right search">
                                            <button style="border-radius:0px; border:1px solid #e5e6e7; border-left:0px" class="btn btn-default btn-outline" type="submit">搜索</button>
                                        </div>

                                        {php}
                                        if(input('?param.name')){
                                        {/php}
                                        <div class="pull-right search">
                                            <a class="btn btn-w-m btn-link" href="{:url('next')}">返回管理</a>
                                        </div>{php}
                                        }
                                        {/php}
                                    </div>
                                </form>
                            </div>
                            <div class="example">
                                <form class="form-horizontal" method="post">
                                    <table data-toggle="table">
                                        <thead>
                                        <tr>
                                            <th data-align="center">ID</th>
                                            <th data-align="center">账号</th>
                                            <th data-align="center">VIP分成占比</th>
                                            <th data-align="center">充值分成占比</th>
                                            <th data-align="center">聊天分成占比</th>
                                            <th data-align="center">一级代理分成占比</th>
                                            <th data-align="center">总分成</th>
                                            <th data-align="center">上级分成</th>
                                            <!--<th data-align="center">总利润</th>-->
                                            <th data-align="center">管理</th>
                                        </tr>
                                        </thead>
                                        <tbody id="form">
                                        {volist name="data" id="v"}
                                        <tr id="id{$v.id}" class="class">
                                            <td>{$v.id}</td>
                                            <td>{$v.name}</td>
                                            <td>{$v.fencheng_vip * 100}</td>
                                            <td>{$v.fencheng_topup * 100}</td>
                                            <td>{$v.fencheng_chat * 100}</td>
                                            <td>{$v.fencheng_prev * 100}</td>
                                            <td>{$v.shouyi}</td>
                                            <td>{:sprintf("%.2f",$v.shouyi * (1 / (1 - $v.fencheng_prev)) * $v.fencheng_prev)}</td>
                                            <!--<td>{$v.shouyi * ($v.fencheng_vip + $v.fencheng_topup + $v.fencheng_chat)}</td>-->
                                            <td>
                                                <div class="btn-group">
                                                    <div data-toggle="dropdown" class="btn btn-primary btn-xs dropdown-toggle">
                                                        操作 <span class="caret"></span>
                                                    </div>
                                                    <ul class="dropdown-menu">
                                                        <li><a onClick="add('{:url('addNext',['id'=>$v['id'],'url'=>-1])}')">修改</a></li>
                                                        <!--<li class="divider"></li>
                                                        <li><a onClick="del({$v.id})" style="color:red">删除</a>
                                                        </li>-->
                                                    </ul>
                                                </div>
                                            </td>
                                        </tr>
                                        {/volist}
                                        </tbody>
                                    </table>
                                </form>
                            </div>
                        </div>
                    </div>
                    <hr>
                    <div class="row row-lg">
                        <div class="col-sm-12 pages">{$page}</div>
                    </div>
                </div>
            </div>
        </div>
        {include file="public/footer" /}
        <script type="text/javascript">

        </script>
 